function foo() {
  var name = 'foo'
  var age = 18;

  function bar() {
    console.log(name)
    console.log(age);
  }

  return bar
}

var fn = foo()
fn()

// 如果此时不想内存泄漏 写 fn = null  foo = null